<?php
require_once '../config/config.php';
require_once '../config/connexion_db.php';
$nom = isset($_POST['chercher']);
if (isset($_POST['action'])&& isset($_POST['chercher']))
$nom = $_POST['chercher']; 
//$nom = isset($_GET['chercher']) ? $_GET['chercher'] : "";
$sql = "SELECT * FROM entreprises, contacts WHERE entreprises.id = contacts.id_entreprise AND nom='$nom'";
$envoi_requete = mysqli_query($connexion_serveur, $sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());

 
//if (isset($_POST['action'])&& !empty($_POST['chercher'])){
//    $nom = $_POST['chercher']; 
//    }

?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="utf-8">
        <title>Liste des contacts</title>
        <link href="../bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
        <link href="../css/style.css" type="text/css" rel="stylesheet">
        
    </head>
    <body>
        
        <?php 
        require_once "../config/css_js_bootstrap/css_js_bootstrap.php"; 
        require_once '../config/menus/menu_principal.php';
        
          
        ?> 
        <br><div id="div2">
                <h3>RECHERCHER DES CONTACTS</h3>
        </div><br>
        <br>
            <br><div id="div1">
           <form> Veuillez saisir un nom :
                <input type="text" name="chercher" id="chercher" placeholder="Rechercher...">
                <input type="submit" id="chercher" name="chercher" value="Chercher"/>
                <input type="hidden" name="action" id="action" value="1">
<?php   
//if (isset($_POST['action'])&& !empty($_POST['chercher'])){
//    $nom = $_POST['chercher']; 
$resultats = mysqli_fetch_array($envoi_requete);
require_once '../contacts/recherche.php';
   

?></form><?php
//$sql = "SELECT * FROM entreprises, contacts WHERE entreprises.id = contacts.id_entreprise AND nom='$nom'"; 
//$envoi_requete = mysqli_query($connexion_serveur, $sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());;
 
                ?>
                
                <br>
           </div>
            
       
        <br>
    </body>
</html>
